<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateShopAttrTable extends Migration
{
    /**
     * @author 张健领
     * Run the migrations.
     * 商品属性表
     * @return void
     */
    public function up()
    {
        Schema::create('shop_attr', function (Blueprint $table) {
            $table->increments('id')->comment('主键');

            $table->integer('gid')->comment('商品id');
            $table->integer('type')->comment('属性分类名');
            $table->string('attr')->comment('商品属性名');
            $table->integer('store')->comment('库存')->nullable();
            $table->float('subtotal', 8, 2)->comment('属性价值');

            //预留字段
            $table->string('field1')->nullable();
            $table->string('field2')->nullable();

            //系统预留字段
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_attr');
    }
}
